﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TableParsers
{
    public class LevelAndUnit
    {
        public int Level { get; private set; }
        public int Unit { get; private set; }

        public static LevelAndUnit Fetch(WebLayer.LoginToken loginToken)
        {
            WebPageParser.WebPageCache pageCache = new WebPageParser.WebPageCache();
            pageCache.LoginToken = loginToken;

            return Fetch(pageCache);
        }
        public static LevelAndUnit Fetch(WebPageParser.WebPageCache pageCache)
        {
            WebPageParser.LevelAndUnitPage webPage = pageCache.GetPage<WebPageParser.LevelAndUnitPage>();

            LevelAndUnit levelAndUnit= new LevelAndUnit();
            levelAndUnit.Level = webPage.Level;
            levelAndUnit.Unit = webPage.Unit;

            return levelAndUnit;
        }
    }
}
